<?php

/**
 * JCLIC_ACTIONS form base class.
 *
 * @method JCLIC_ACTIONS getObject() Returns the current form's model object
 *
 * @package    Projecte Final de Carrera
 * @subpackage form
 * @author     Jaume Fernandez
 * @version    SVN: $Id: sfDoctrineFormGeneratedTemplate.php 29553 2010-05-20 14:33:00Z Kris.Wallsmith $
 */
abstract class BaseJCLIC_ACTIONSForm extends BaseFormDoctrine
{
  public function setup()
  {
    $this->setWidgets(array(
      'session_id'    => new sfWidgetFormInputHidden(),
      'activity_id'   => new sfWidgetFormInputHidden(),
      'action_id'     => new sfWidgetFormInputHidden(),
      'action_type'   => new sfWidgetFormInputText(),
      'action_source' => new sfWidgetFormInputText(),
      'action_dest'   => new sfWidgetFormInputText(),
      'action_ok'     => new sfWidgetFormInputText(),
    ));

    $this->setValidators(array(
      'session_id'    => new sfValidatorChoice(array('choices' => array($this->getObject()->get('session_id')), 'empty_value' => $this->getObject()->get('session_id'), 'required' => false)),
      'activity_id'   => new sfValidatorChoice(array('choices' => array($this->getObject()->get('activity_id')), 'empty_value' => $this->getObject()->get('activity_id'), 'required' => false)),
      'action_id'     => new sfValidatorChoice(array('choices' => array($this->getObject()->get('action_id')), 'empty_value' => $this->getObject()->get('action_id'), 'required' => false)),
      'action_type'   => new sfValidatorString(array('max_length' => 20)),
      'action_source' => new sfValidatorString(array('max_length' => 255, 'required' => false)),
      'action_dest'   => new sfValidatorString(array('max_length' => 255, 'required' => false)),
      'action_ok'     => new sfValidatorInteger(array('required' => false)),
    ));

    $this->widgetSchema->setNameFormat('jclic_actions[%s]');

    $this->errorSchema = new sfValidatorErrorSchema($this->validatorSchema);

    $this->setupInheritance();

    parent::setup();
  }

  public function getModelName()
  {
    return 'JCLIC_ACTIONS';
  }

}
